file chooser: Make Escape go out of search mode
authorMatthias Clasen <mclasen@redhat.com>
Wed, 28 Jan 2015 21:06:02 +0000 (16:06 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 28 Jan 2015 21:07:51 +0000 (16:07 -0500)
This works in most other places where we have search,
and is the expected behavior.

gtk/gtkfilechooserwidget.c
gtk/ui/gtkfilechooserwidget.ui

index 943408197589ca3dc14552c60e4598460922a7f1..bc9224ef4728db572b83764c9c8243f1fba28f90 100644 (file)
@@ -527,6 +527,7 @@ static void     search_clear_model           (GtkFileChooserWidget *impl,
 static gboolean search_should_respond        (GtkFileChooserWidget *impl);
 static GSList  *search_get_selected_files    (GtkFileChooserWidget *impl);
 static void     search_entry_activate_cb     (GtkFileChooserWidget *impl);
+static void     search_entry_stop_cb         (GtkFileChooserWidget *impl);
 static void     settings_load                (GtkFileChooserWidget *impl);
 
 static void     show_filters                 (GtkFileChooserWidget *impl,
@@ -6257,6 +6258,12 @@ search_entry_activate_cb (GtkFileChooserWidget *impl)
   search_start_query (impl, text);
 }
 
+static void
+search_entry_stop_cb (GtkFileChooserWidget *impl)
+{
+  operation_mode_set (impl, OPERATION_MODE_BROWSE);
+}
+
 /* Hides the path bar and creates the search entry */
 static void
 search_setup_widgets (GtkFileChooserWidget *impl)
@@ -7425,6 +7432,7 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
   gtk_widget_class_bind_template_callback (widget_class, places_sidebar_show_error_message_cb);
   gtk_widget_class_bind_template_callback (widget_class, places_sidebar_show_enter_location_cb);
   gtk_widget_class_bind_template_callback (widget_class, search_entry_activate_cb);
+  gtk_widget_class_bind_template_callback (widget_class, search_entry_stop_cb);
 }
 
 static void
index d04346b2096aa035310e3525216a8e9353cace87..a2617d90e37a35eb74030e3365e2797a31bd8b49 100644 (file)
                                 <property name="visible">True</property>
                                 <property name="hexpand">True</property>
                                 <signal name="search-changed" handler="search_entry_activate_cb" swapped="yes"/>
+                                <signal name="stop-search" handler="search_entry_stop_cb" swapped="yes"/>
                               </object>
                             </child>
                           </object>